package com.px.controller;

import com.px.mapper.TradeDao;
import com.px.pojo.ShTrade;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class ProviderPayController {

    @Resource
    private TradeDao tradeDao;


    @PostMapping("/api/provider/pay/selectTradeCountByTradeNo")
    public Integer selectTradeCountByTradeNo(@RequestBody Map<String,Object> map) throws Exception{
        return tradeDao.selectTradeCountList(map);
    }

    @PostMapping("/api/provider/pay/saveTrade")
    public Integer saveTrade(@RequestBody ShTrade shTrade) throws Exception{
        return tradeDao.saveTrade(shTrade);
    }

    @PostMapping("/api/provider/pay/selectTradeByOrderNo")
    public ShTrade selectTradeByOrderNo(@RequestParam String orderNo) throws Exception{
        return tradeDao.selectTradeByOrderNo(orderNo);
    }

    @PostMapping("/api/provider/pay/deleteByTradeNo")
    public Integer deleteByTradeNo(@RequestParam String tradeNo) throws Exception{
        return tradeDao.deleteByTradeNo(tradeNo);
    }

}
